package com.ibeeking.found.open.b.rest.controller.v1;

import com.ibeeking.found.open.b.rest.service.IQrService;
import com.ibeeking.found.open.service.common.dto.QrSceneDTO;
import com.ibeeking.found.open.service.common.param.QrCreateParam;
import com.ibeeking.nematos.constants.enums.OperateLogTypeEnum;
import com.ibeeking.nematos.log.annotation.Log;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @ClassName QrController控制器
 * @Description
 * @Author ibeeking
 * @Date 2021-06-02 18:15
 **/
@RestController
@RequestMapping("/v1/api/qrCode")
public class QrController {

    @Resource
    private IQrService qrServiceImpl;

    @Log(logType = OperateLogTypeEnum.QUERY, describe = "二维码场景列表查询")
    @PostMapping(value = "/scenes")
    public List<QrSceneDTO> scenes() {
        return qrServiceImpl.scenes();
    }

    @Log(logType = OperateLogTypeEnum.QUERY, describe = "生成二维码")
    @PostMapping(value = "/createQR")
    public void createQr(@RequestBody @Validated QrCreateParam param, HttpServletResponse response) {
        qrServiceImpl.createQr(param,response);
    }
}
